<?php
	
	class GetHeaderXmlAction extends DirectAction {
		
		public function GetHeaderXmlAction()
		{
			parent::DirectAction("GetHeaderXmlAction");
		}
		
		public function serveRequest() {
			
			parent::serveRequest();
			
			$response = new XMLResponse("header");
			FunctionLibrary::nocache();
			
			$siteId = FunctionLibrary::getGetValueSmart("siteId", null);
			if(!is_null($siteId))
				$siteId = intval($siteId);
			
			$xmlTpl = DirectAction::loadTemplateFile("getheader.tpl.xml");
			
			$picUrl = SiteHelper::getBannerPicture();
			if(is_null($picUrl))
				$picUrl = "";
			$bannerText = SiteHelper::getBannerText($siteId);
			if(is_null($bannerText))
				$bannerText = "";
			else
				$bannerText = str_replace("\n", "\\n", $bannerText);
			
			$xmlTpl->setVariable("picUrl", $picUrl);
			$xmlTpl->setVariable("bannerText", $bannerText);
			
			return $response->generateResponse($xmlTpl->get());
		}
		
	}
?>